<%-- 
    Document   : SubirArchivo-Prueba
    Created on : 09-feb-2015, 11:19:44
    Author     : uotu
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
        <title>JSP Page</title>
        <script>
            if (window.XMLHttpRequest)
            {
                var ajax = new XMLHttpRequest();
            }
            function SubirImagen()
            {
                var frm = new FormData();
                frm.append("archivo", document.frm1.multipartfile.files[0]);
                ajax.open("post", "subirDocumento.htm", true);
                ajax.onreadystatechange = (function () {
                    if (ajax.readyState == 4)
                    {
                        alert(ajax.responseText);
                    }
                });
                ajax.contentType = "multipart/form-data";
                ajax.send(frm);
            }
        </script>
    </head>
    <body>
        <form name="frm1" method="POST" enctype="multipart/form-data" action="subirDocumento.htm">
            <input type="file" name="multipartfile"/>
            <button type="button" onclick="SubirImagen()">subir doc</button>
        </form>
    </body>
</html>
